package com.yunjing.elasticjob.entity;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.List;

/**
 * @author zhiqi.shao
 * @Date 2018/6/13 13:50
 */
public interface JobConfigRepository extends JpaRepository<JobConfig, Long> {


    @Transactional
    @Modifying
    @Query(value = "update job_config set overdue=1 where id =?1", nativeQuery = true)
    int updateOverdueById(Long id);

    @Query(value = "select  job from  JobConfig job where  job.overdue=?1")
    List<JobConfig> findInitJobConfig(int overdue);
}
